#include "app_message.h"
#include <stdio.h>

int main(int argc, char const *argv[])
{
    // 将字节数组转换成json字符串实验
    // char data[9] = {0x01, 0x02, 0x03, 0x6e, 0x6e, 0x41, 0x42, 0x43};
    // char *json = app_message_bytes_to_json(data, 9);
    // printf("json:%s\n", json);

    // 将json字符串转换成字节数组实验
    char *json_str = "{\"conn_type\":1,\"id\":\"6e6e\",\"msg\":\"414243\"}";
    char bytes[20];
    int len = app_message_json_to_bytes(json_str, bytes, 20);
    for (size_t i = 0; i < len; i++)
    {
        printf("%02x ", bytes[i]);
    }
    printf("\n");
    return 0;
}
